/**
 * FizzBuzz exercise from TW101 Module 1
 *
 * Created by dmorti on 12/02/14.
 */
public class FizzBuzzExercise {
    public static void main(String[] args) {
        FizzBuzzExercise exercise = new FizzBuzzExercise();

        System.out.println(exercise.fizzBuzz(15));
    }

    private String fizzBuzz(int n) {
        String output = "";
        for (int i=1; i<=n; i++) {
            output += fizzbuzzify(i) + "\n";
        }
        return output;
    }

    private String fizzbuzzify(int n) {
        if (n % 5 == 0 && n % 3 == 0) return "FizzBuzz";
        if (n % 3 == 0) return "Fizz";
        if (n % 5 == 0) return "Buzz";
        return Integer.toString(n);
    }
}
